<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>BlackStar Monitor&amp;Profile System</title>
        <meta http-equiv="pragma" content="no-cache" />
        <link rel="stylesheet" type="text/css" href="/static/extjs/resources/css/ext-all.css" rel="stylesheet" />
        <script type="text/javascript" src="/static/extjs/adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="/static/extjs/ext-all.js"></script>    
        <script type="text/javascript" src="../js/help.js"></script>    
        <script type="text/javascript">
Ext.onReady(function(){
    Ext.QuickTips.init();
	Ext.form.Field.prototype.msgTarget = 'side';

    var name = QueryString('name');
	var time = QueryString('time');
    
    var dataStore = new Ext.data.Store({
     	proxy : 
     		new Ext.data.HttpProxy({url : '../performance/' + name + '/' + time}),
     	reader : 
     		new Ext.data.JsonReader({
                  totalProperty : 'count',
                  root : 'list'
              	}, [
                  {name : 'name'},
                  {name : 'totalInvokes'},
                  {name : 'totalTime'},
                  {name : 'avarage'},
                  {name : 'percent'},
                  {name : 'lt10ms'},
                  {name : 'lt50ms'},
                  {name : 'lt100ms'},
                  {name : 'lt300ms'},
                  {name : 'lt500ms'},
                  {name : 'lt1s'},
                  {name : 'lt3s'},
                  {name : 'ge3s'}
                   ]
             	)
	});
    
    var timeFormat = function(value, cellmeta, record, rowIndex) {
    	return value + "ms";
    }
    var percentFormat = function(value, cellmeta, record, rowIndex) {
    	return value + "%";
    }            
    var gridPannel = new Ext.grid.GridPanel({
        renderTo: Ext.getBody(),
		width:  '100%',
        height:  420,
		store : dataStore,
        columns: [
            {id:'name', header: "名称", sortable: true, width: 300, dataIndex: 'name'},
            {header: "总次数", width: 70, sortable: true, align: 'right',dataIndex: 'totalInvokes'},
            {header: "总时间", width: 70, sortable: true, align: 'right',hidden : true, renderer:timeFormat, dataIndex: 'totalTime'},
            {header: "平均时间(ms/t)", width: 100, sortable: true, align: 'right', renderer:timeFormat, dataIndex: 'avarage'},
            {header: "比例",width: 70,  sortable: true, align: 'right',renderer:percentFormat, dataIndex: 'percent'},
            {header: "<10ms",width: 70,  sortable: true, hidden : true, align: 'right',renderer:timeFormat, dataIndex: 'lt10ms'},
            {header: ">=10ms",width: 70,  sortable: true, hidden : true, align: 'right',renderer:timeFormat, dataIndex: 'lt50ms'},
            {header: ">=50ms",width: 70,  sortable: true, hidden : true, align: 'right',renderer:timeFormat, dataIndex: 'lt100ms'},
            {header: ">=100ms",width: 70,  sortable: true, hidden : true, align: 'right',renderer:timeFormat, dataIndex: 'lt300ms'},
            {header: ">=300ms",width: 70,  sortable: true, align: 'right',renderer:timeFormat, dataIndex: 'lt500ms'},
            {header: ">=500ms",width: 70,  sortable: true, align: 'right',renderer:timeFormat, dataIndex: 'lt1s'},
            {header: ">=1s",width: 70,  sortable: true,  align: 'right',renderer:timeFormat, dataIndex: 'lt3s'},
            {header: ">=3s",width: 70,  sortable: true,  align: 'right',renderer:timeFormat, dataIndex: 'ge3s'}
        ],
        loadMask: {msg:'正在加载数据，请稍侯……'}
    	});
    	
    dataStore.load();
});
        </script>
    </head>
    <body style="padding: 10px;"></body>
</html>